package dwei.ui
{
	import dwei.ui.core.ValidateSprite;
	
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	public class UISprite extends ValidateSprite implements IUI
	{
//============================================================================
//PROPERTY
//============================================================================
		protected var _delay:uint;
		protected var _layer:uint;
		protected var _exclude:Boolean;
		protected var _verticalAlign:String;
		protected var _horizontalAlign:String;
//============================================================================
//CONSTRUCTOR
//============================================================================
		public function UISprite()
		{
			super();
			_delay = _layer = 0;
			_exclude = false;
			_verticalAlign = _horizontalAlign = UIAlign.CUSTOM;
		}
//============================================================================
//METHOD
//============================================================================
		//====================================================================
		//OVERRIDE
		//====================================================================
		override protected function updateDisplayList():void
		{
			super.updateDisplayList();
			
			var ui:IUI;
			var length:int = numChildren;
			var containerRect:Rectangle = new Rectangle(x, y, width, height);
			for (var index:int = 0;index < length;index++)
			{
				ui = getChildAt(index) as IUI;
				if (ui != null) UIMgr.layout(ui, containerRect);
			}
		}
//============================================================================
//GETTER/SETTER
//============================================================================
		
		public function get delay():uint
		{
			return _delay;
		}

		public function set delay(value:uint):void
		{
			_delay = value;
		}
		
		public function get layer():uint
		{
			return _layer;
		}

		public function set layer(value:uint):void
		{
			_layer = value;
		}
		
		public function get exclude():Boolean
		{
			return _exclude;
		}

		public function set exclude(value:Boolean):void
		{
			_exclude = value;
		}
		
		public function get verticalAlign():String
		{
			return _verticalAlign;
		}

		public function set verticalAlign(value:String):void
		{
			_verticalAlign = value;
		}
		
		public function get horizontalAlign():String
		{
			return _horizontalAlign;
		}

		public function set horizontalAlign(value:String):void
		{
			_horizontalAlign = value;
		}


	}
}